//
//  HQAPPConfigInfo.h
//  HqAppArchitect
//
//  Created by litianqi on 2021/11/30.
//  Copyright © 2021 edu24ol. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>

NS_ASSUME_NONNULL_BEGIN

@interface HQBaseConfig : NSObject
+ (instancetype)shareInstance;
///required
/** app 配置信息 */
@property (nonatomic, copy) NSString *appId;
@property (nonatomic, copy) NSString *appName;
@property (nonatomic, copy) NSString *deviceId;//用于角色判断
@property (nonatomic, copy) NSString *versionApp;
@property (nonatomic, assign) NSInteger buildId;
///机构id
@property (nonatomic, copy) NSString *orgId;
///url scheme
@property (nonatomic, copy) NSString *appScheme;

///用户信息
@property (nonatomic, readonly) NSString *token;
@property (nonatomic, copy) NSString *(^getTokenBlock)(void);

@property (nonatomic, readonly) long long userId;
@property (nonatomic, copy) long long (^getUserIdBlock)(void);

@property (nonatomic, readonly) NSString *userName;
@property (nonatomic, copy) NSString *(^getUserNameBlock)(void);

@property (nonatomic, readonly) NSString *nickName;
@property (nonatomic, copy) NSString *(^getNickNameBlock)(void);

@property (nonatomic, readonly) NSString *faceUrl;//
@property (nonatomic, copy) NSString *(^getFaceUrlBlock)(void);

///是否普通用户
@property (nonatomic, readonly) BOOL isNormalUser;
@property (nonatomic, copy) BOOL (^getIsNormalUser)(void);

///考试意向
@property (nonatomic, assign) NSInteger intendId;
@property (nonatomic, copy) NSInteger (^getIntendId)(void);
///多个考试意向，逗号拼接
@property (nonatomic, copy) NSString * intendIdList;
@property (nonatomic, copy) NSString *(^getIntendIdList)(void);


///支付信息
@property (nonatomic, strong) NSString *wxAppId;
@property (nonatomic, strong) NSString *jdAppId;
@property (nonatomic, copy) NSString *merchantId_jd;


///网络配置
//默认域名
@property (nonatomic, copy) NSString *defaultReqUrlDomin;
////公共域名-enabelReqUrlDomin 启用，才会有效
@property (nonatomic, copy) NSString *reqUrlDomin;
/** 是否启用公共域名：reqUrlDomin;默认是no */
@property (nonatomic, assign) BOOL enabelReqUrlDomin;

/** 网络公共参数-会添加到请求链接 */
@property (nonatomic, copy) NSDictionary *param;

/*自定义特殊域名@{path:domain},默认会采用reqUrlDomin
 @{@"xxx/xx":@"http://www.test.com"}
 */
@property (nonatomic, copy) NSDictionary<NSString *,NSString *> *specialReqUrlDominDic;

@property (nonatomic, strong) UIColor *themeColor;  //主题色

@property (nonatomic, copy) NSString *unitsPrefixText; //价格前缀符号
@property (nonatomic, copy) NSString *(^getUnitsPrefixTextBlock)(void); //价格符号


@property (nonatomic, copy) NSString * (^getDataApiProductUrlBlock)(void);

@property (nonatomic, copy) NSString * (^getDataApiBaseUrlBlock)(void);


- (void)addCustomUrlPath:(NSString *)urlPath toDomain:(NSString *)domain;


+ (UIImage *)themeFillImage:(UIImage *)image;

@end


@interface HQBaseConfig (UserRole)
+ (void)hq_checkUserRoleResult:(void(^)(BOOL isNormal))resultBlock;
@end


#define IPhoneX_HQAPPConfigInfo HQAPPConfigInfo_IsNotchScreen()
static inline bool HQAPPConfigInfo_IsNotchScreen() {
    if (@available(iOS 11.0, *)) {
        UIEdgeInsets safeAreaInsets = [UIApplication sharedApplication].windows[0].safeAreaInsets;
        if (UIInterfaceOrientationIsLandscape([UIApplication sharedApplication].statusBarOrientation)) {
            return safeAreaInsets.left > 0.0f;
        }else {
            // ios12 非刘海屏safeAreaInsets为（20，0，0，0）,所以大于20.0才是刘海屏
            return safeAreaInsets.top > 20.0f;
        }
    } else {
        return NO;
    }
}

NS_ASSUME_NONNULL_END

